package com.unit.test.ordersystem.group;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: sijunqiang
 * @Date: 2020/5/10 14:21
 * @Description:
 */
@Service
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class GroupBaseFeign {

    public RestTemplate initRestTemplate() {
        return new RestTemplate();
    }

    @Order(1)
    @DisplayName(value = "根据关键字查询群组的列表")
    @Test
    public void selectGroupList() {
        RestTemplate restTemplate = initRestTemplate();
        long start = System.currentTimeMillis();
        String response = restTemplate.getForObject("http://localhost:8080/v1.0/workOrder/group/queryGroupList", String.class);
        long endTime = System.currentTimeMillis();
        long time = endTime - start;
        log.info("响应的时间:[{}]毫秒,\n响应的内容:[{}]", time, response);
    }





}
